<?php
/**
 * Created by PhpStorm.
 * User: hyt
 * Date: 2017/7/17
 * Time: 13:57
 */
function sendMail($subject,$html,$sentTo,$name,$fromName){
    require('../lib/class.phpmailer.php');
    $mail = new PHPMailer(true); //建立邮件发送类
    $mail->CharSet = "UTF-8";//设置信息的编码类型
    $mail->IsSMTP(); // 使用SMTP方式发送
    $mail->Host = "smtp.126.com";
    $mail->SMTPAuth = true; // 启用SMTP验证功能
    $mail->Username = "activeuser";
    $mail->Password = "he18860366839";
    $mail->Port = 25;//邮箱服务器端口号
    $mail->From = "activeuser@126.com"; //邮件发送者email地址
    $mail->FromName = $fromName;//发件人名称
    $mail->IsHTML(true);
    $mail->AddAddress("$sentTo", "$name");
    $mail->Subject = $subject; //邮件标题
    $mail->Body = $html; //邮件内容，上面设置HTML，则可以是HTML
    if (!$mail->Send())
        return false;
        //echo"邮件发送失败. <p>";
        //echo"错误原因: " . $mail->ErrorInfo;
    return true;
}
?>